package com.hn.hnspringbootdemo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.net.www.http.HttpClient;

import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/new")
public class NewController {

    /**
     * 添加数据
     *
     * @return
     */
    @GetMapping("add")
    public Map<String, Object> commonBusService() throws IOException {
        // 分公司接口
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("hn", "河南");

        URL url = new URL("http://www.baidu.com");
        HttpClient client = HttpClient.New(url, true);
        OutputStream stream = client.getOutputStream();

        return map;
    }
}
